﻿using System;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Plumbing;
using Autodesk.Revit.UI.Selection;
using YArchitech.Revit;

namespace YArchitech.HVAC
{
	public class PipeAndFireHydrantSelectionFilter : ISelectionFilter
	{
		public bool AllowElement(Element elem)
		{
			if (elem is Pipe)
			{
				return true;
			}
			if (elem is FamilyInstance)
			{
                if (YJKRevitTools.GetElementConnector((Domain)3, elem) == null)
				{
					return false;
				}
				if (elem.Category.Id.IntegerValue == -2001140)
				{
					return true;
				}
			}
			return false;
		}

		public bool AllowReference(Reference reference, XYZ position)
		{
			return false;
		}
	}
}
